Transform and rotate
Rotates an image by any angle.
🖼️ Image options and parameters of transformRotate
method
transformRotate
method rotates image anti-clockwise at any angle that user sets. It applies the same principle as transform method, but user only needs to pass a rotation angle as a parameter instead of the whole matrix.


Parameters and its default values
angle
options
Options
Property | Required | Default value |
---|---|---|
borderType | no | constant |
borderValue | no | 0 |
center | no | center |
fullImage | no | - |
height | no | - |
interpolationType | no | bilinear |
inverse | no | - |
scale | no | 1 |
width | no | - |
info
Technically, transform
method can still be applied to rotate an image. However it is harder.
This means that ,to rotate an image by 90 degrees anti-clockwise, you can use transform
method like this:
const center = image.getCoordinates('center');
return image.transform([
[0, 1, center.column - center.row],
[-1, 0, center.column + center.row],
]);
Or use transformRotate
method like this:
return image.transformRotate(90);
transformRotate
just facilitates this process.